package com.ls.blog.consumer;

import com.ls.blog.dto.EmailDTO;
import com.ls.blog.utils.MailUtils;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = "emailQueue")
public class EmailConsumer {
    @Autowired
    MailUtils mailUtils;

    @RabbitHandler
    public void process(EmailDTO emailDTO){
        mailUtils.sendMail(emailDTO);
    }

}
